
<!---->
<div class="am-gallery-item">
    <a href="{:U('Event/Index/detail',array('id'=>$vo['id']))}" class="">
      <img src="{$vo.cover_id|getThumbImageById=354,208}"  alt="{$vo.title}"/>
    </a>
    <h3 class="am-gallery-title"><a href="{:U('Event/Index/detail',array('id'=>$vo['id']))}" class="">{$vo.title}</a></h3>
    <div class="am-gallery-desc">
		<p><span>活动地点：</span>{$vo.address}</p>
		<p><span>发起组织：</span>{$vo.group.title}</p>
		<p><span>报名时间：</span>{:date('Y-m-d',$vo['deadline'])}截止</p>
		<p><span>报名人数：</span>{$vo.signCount}</p>
		<if condition="($vo['uid'] eq is_login()) OR is_administrator(is_login())">

                    <if condition="time() lt $vo['eTime']">
                        <a class="btn btn-default endEvent" data-eventID="{$vo.id}"><i class="fa am-icon-clock-o"></i>&nbsp;{:L('_OVER_AHEAD_')}</a>
                    </if>

                    <a href="{:U('edit',array('id'=>$vo['id']))}" class="btn btn-default"><i class="fa am-icon-edit"></i>&nbsp;{:L('_EVENT_EDIT_')}</a>
                    <a class="btn btn-default delEvent" data-eventID="{$vo.id}"><i class="fa am-icon-close"></i>&nbsp;{:L('_EVENT_DELETE_')}</a>
                </if>
                <if condition="($vo['uid'] neq is_login())">
                    <php>if(!$vo['check_isSign']){</php>

                    <php>if($vo['deadline'] < time()){</php>
                    <p class="join-a"><a class="join grey" href="javascript:">报名<br/>已截止</a></p>
                    <php>}else{</php>
                    <if condition="is_login() eq 0">
                        <p class="join-a"><a class="join" href="javascript:" onclick="toast.error({:L('_ERROR_REGISTER_AFTER_LOGIN_')})" style="color: #fff">报名<br/>参加</a></p>
                        <else/>
                        <if condition="check_auth('Event/Index/doSign')">
                            <p class="join-a"><a class="join event_sign " style="color: #fff" href="{:U('ajax_sign',array('event_id'=>$vo['id']))}">立即<br/>报名</a></p>
                        </if>
                    </if>
                    <php>}</php>
                    <php>}else{</php>
                    <p class="join-a"><a class="join unSign " data-eventID="{$vo.id}" href="javascript:" id="unSign">取消<br/>报名</a>

                    <span class="msg" style="line-height: 34px;"> {:L('_REGISTER_ED_')}&nbsp;&nbsp;<if condition="$vo['check_isSign'][0]['status'] eq 1">{:L('_AUDIT_ED_')}
                        <else/>
	                        {:L('_AUDIT_OP_')}
	                    </if></span>
	                    </p>
                    <php>}</php>
                </if>
    </div>{$content.id}
</div>
<block name="script">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script>
        $(function () {
            $('#top_nav >li >a ').mouseenter(function () {
                $('.children_nav').hide();
                $('#children_' + $(this).attr('data')).show();
            });


            $('.event_sign').magnificPopup({
                type: 'ajax',
                overflowY: 'scroll',
                modal: true,
                callbacks: {
                    ajaxContentAdded: function () {
                        console.log(this.content);
                    }
                }
            });



            /**
             * 取消报名
             * */
            $('#unSign').click(function () {
                if (confirm("{:L('_PROMPT_CANCEL_')}{:L('_QUESTION_')}")) {
                    var event_id = "{$content['id']}";
                    $.post("{:U('Event/Index/unSign')}", {event_id: event_id}, function (res) {
                        if (res.status) {
                            toast.success(res.info);
                            setTimeout(function () {
                                location.reload();
                            }, 1500);
                        }
                        else {
                            toast.error(res.info);
                        }
                    }, 'json');
                }
            });
            /**
             * 删除活动事件
             * */
            $('#delEvent').click(function () {
                if (confirm("{:L('_PROMPT_DELETE_')}{:L('_QUESTION_')}")) {
                    var event_id = "{$content['id']}";
                    $.post("{:U('Event/Index/doDelEvent')}", {event_id: event_id}, function (res) {
                        if (res.status) {
                            toast.success(res.info);
                            setTimeout(function () {
                                location.href = "{:U('index')}";
                            }, 1500);
                        }
                        else {
                            toast.error(res.info);
                        }
                    }, 'json');
                }
            });
            /**
             * 提前结束活动点击事件
             */
            $('#endEvent').click(function () {
                if (confirm("{:L('_PROMPT_OVER_')}{:L('_QUESTION_')}")) {
                    var event_id = "{$content['id']}";
                    $.post("{:U('Event/Index/doEndEvent')}", {event_id: event_id}, function (res) {
                        if (res.status) {
                            toast.success(res.info);
                            setTimeout(function () {
                                location.reload();
                            }, 1500);
                        }
                        else {
                            toast.error(res.info);
                        }
                    }, 'json');
                }
            });
        })
    </script>

</block>
